<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>酷妈妈商城</title>
<script type="text/javascript">
 function checkForm(){
	 var price = 23;
	 if(price == null || price == ""){
		 alert("价格不能为空!");
		 return false;
	 }else if(isNaN(price)||parseFloat(price)<= 0){ // is not a number
	 alert(parseFloat(price));
			alert("输出价格必须为数字且大于0！");
	 alert(parseFloat(price));
			return false;
		}	
		// 其它的这里 暂不校验 
 }
</script>
</head>
<body>
	<h1>添加商品</h1>
	<h4 style="color: red;">${msg}</h4>
	<form action="AddProductServlet" method="post" enctype="multipart/form-data"
		onsubmit="return checkForm();">
		<table>
			<tr>
				<td>商品名称：</td>
				<td><input type="text" name="name" id="name" /></td>
			</tr>
			<tr>
				<td>商品价格：</td>
				<td><input type="text" name="price" id="price" /></td>
			</tr>
			<tr>
				<td>商品分类</td>
				<td><select name="category">
						<option value="数码相机">数码相机</option>
						<option value="手机">手机</option>
						<option value="电脑">电脑</option>
						<option value="电视">电视</option>
				</select></td>
			</tr>
			<tr>
				<td>商品描述：</td>
				<td><textarea rows="4" cols="50" name="description"
						id="description"></textarea></td>
			</tr>
			<tr>
				<td>附件上传：</td>
				<td><input type="file" name="img" /> </td>
			</tr>
			<tr>
				<td></td>
				<td><input type="submit" value="添加商品" /> </td>
			</tr>
		</table>

	</form>
</body>
</html>